﻿<Controls:PhoneApplicationPage x:Class="TexasHoldemCalculator.View.StartingHandsSelectionView"
                               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                               xmlns:Controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                               xmlns:Controls1="clr-namespace:Microsoft.Live.Controls;assembly=Microsoft.Live.Controls"
                               xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                               xmlns:MvvmLite="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
                               xmlns:my="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"
                               x:Name="StartingHandsSelectionViewPage"
                               ApplicationBar="{StaticResource GlobalApplicationBar}"
                               d:DesignHeight="800"
                               d:DesignWidth="480"
                               DataContext="{Binding Source={StaticResource Locator}, Path=StartingHands}"
                               Style="{StaticResource DefaultPageTransition}"
                               SupportedOrientations="Portrait"
                               mc:Ignorable="d">
	<Controls:PhoneApplicationPage.Resources>
		<DataTemplate x:Key="DataTemplate1">
			<Grid/>
		</DataTemplate>
		<Style x:Key="PhoneButtonBase" TargetType="ButtonBase">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
			<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
			<Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
			<Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
			<Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
			<Setter Property="Padding" Value="10,3,10,5"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ButtonBase">
						<Grid Background="Transparent">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="MouseOver"/>
									<VisualState x:Name="Pressed">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
												<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}">
								<ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
							</Border>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="PhoneRadioButtonCheckBoxBase" BasedOn="{StaticResource PhoneButtonBase}" TargetType="ToggleButton">
			<Setter Property="Background" Value="{StaticResource PhoneRadioCheckBoxBrush}"/>
			<Setter Property="BorderBrush" Value="{StaticResource PhoneRadioCheckBoxBrush}"/>
			<Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/>
			<Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
			<Setter Property="HorizontalContentAlignment" Value="Left"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Padding" Value="0"/>
		</Style>
		<Style x:Key="RadioButtonStyle1" BasedOn="{StaticResource PhoneRadioButtonCheckBoxBase}" TargetType="RadioButton">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="RadioButton">
						<Grid Background="Transparent">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="MouseOver"/>
									<VisualState x:Name="Pressed">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="EnabledCheckBackground">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PressedDarkCheckBackground">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PressedLightCheckBackground">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="CheckMark">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneRadioCheckBoxCheckBrush}"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="EnabledCheckBackground">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DisabledDarkCheckBackground">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DisabledLightCheckBackground">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="CheckMark">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneRadioCheckBoxCheckDisabledBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="CheckStates">
									<VisualState x:Name="Checked">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="CheckMark">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Unchecked"/>
									<VisualState x:Name="Indeterminate"/>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Grid>
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="32"/>
									<ColumnDefinition Width="*"/>
								</Grid.ColumnDefinitions>
								<Ellipse x:Name="EnabledCheckBackground" Fill="{TemplateBinding Background}" HorizontalAlignment="Left" Height="32" IsHitTestVisible="False" VerticalAlignment="Center" Width="32"/>
								<Canvas HorizontalAlignment="Left" Height="32" IsHitTestVisible="False" Opacity="{StaticResource PhoneDarkThemeOpacity}" VerticalAlignment="Center" Width="32">
									<Ellipse x:Name="PressedDarkCheckBackground" Fill="{StaticResource PhoneRadioCheckBoxPressedBrush}" Height="32" Visibility="Collapsed" Width="32"/>
									<Ellipse x:Name="DisabledDarkCheckBackground" Fill="{StaticResource PhoneRadioCheckBoxDisabledBrush}" Height="32" Visibility="Collapsed" Width="32"/>
								</Canvas>
								<Canvas HorizontalAlignment="Left" Height="32" IsHitTestVisible="False" Opacity="{StaticResource PhoneLightThemeOpacity}" VerticalAlignment="Center" Width="32">
									<Ellipse x:Name="PressedLightCheckBackground" Fill="{StaticResource PhoneRadioCheckBoxPressedBrush}" Height="32" Stroke="{StaticResource PhoneForegroundBrush}" StrokeThickness="{StaticResource PhoneStrokeThickness}" Visibility="Collapsed" Width="32"/>
									<Ellipse x:Name="DisabledLightCheckBackground" Fill="{StaticResource PhoneRadioCheckBoxDisabledBrush}" Height="32" Stroke="{StaticResource PhoneDisabledBrush}" StrokeThickness="{StaticResource PhoneStrokeThickness}" Visibility="Collapsed" Width="32"/>
								</Canvas>
								<Ellipse x:Name="CheckMark" Fill="{StaticResource PhoneRadioCheckBoxCheckBrush}" HorizontalAlignment="Center" Height="16" IsHitTestVisible="False" Visibility="Collapsed" VerticalAlignment="Center" Width="16"/>
								<ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="12,0,0,0" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
							</Grid>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</Controls:PhoneApplicationPage.Resources>
    <Grid x:Name="LayoutRoot">
        <Border Style="{StaticResource MainBorderStyle}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="65" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="85" />
                    <RowDefinition Height="85" />
                </Grid.RowDefinitions>

                <TextBlock Grid.Row="0"
                           d:IsHidden="True"
                           Style="{StaticResource THCStatsLargeHeaderText}"
                           Text="Starting Hands" />
                <ListBox Name="StartingHandsListBox"
                         Grid.Row="1"
                         d:IsHidden="True"
                         ItemContainerStyle="{StaticResource RadioButtonListItemContextMenuStyle}"
                         ItemsSource="{Binding StartingHandsByTitle}"
                         SelectedItem="{Binding SelectedStartingHand, Mode=TwoWay}" />

                <!--<delay:DeferredLoadListBox Name="StartingHandsListBox" Grid.Row="1"
                                           ItemsSource="{Binding StartingHandsByTitle}"
                                           SelectedItem="{Binding SelectedStartingHand, Mode=TwoWay}">
                    <delay:DeferredLoadListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Height="50">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="350"/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
                                <RadioButton  Foreground="{StaticResource PhoneAccentBrush}"
                                              IsChecked="{Binding IsSelected, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" >
                                    <RadioButton.Content>
                                        <TextBlock Text="{Binding Title}" TextWrapping="Wrap" />
                                    </RadioButton.Content>
                                    <toolkit:ContextMenuService.ContextMenu>
                                        <toolkit:ContextMenu VerticalOffset="-100">
                                            <toolkit:MenuItem Header="Delete" Tag="Delete" Style="{StaticResource ContextMenuItemStyle}" >
                                                <i:Interaction.Triggers>
                                                    <i:EventTrigger EventName="Click">
                                                        <MvvmLite:EventToCommand x:Name="DeleteHandCommand"
                                                                                 Command="{Binding Source={StaticResource Locator}, Path=StartingHands.DeleteHandCommand}" 
                                                                                 CommandParameter="{Binding Title}"/>
                                                    </i:EventTrigger>
                                                </i:Interaction.Triggers>
                                            </toolkit:MenuItem>
                                        </toolkit:ContextMenu>
                                    </toolkit:ContextMenuService.ContextMenu>
                                </RadioButton>
                            </Grid>
                        </DataTemplate>
                    </delay:DeferredLoadListBox.ItemTemplate>
                    <delay:DeferredLoadListBox.ItemContainerStyle>
                        <Style TargetType="ListBoxItem">
                            <Setter Property="Height" Value="50"/>
                        </Style>
                    </delay:DeferredLoadListBox.ItemContainerStyle>
                    <delay:DeferredLoadListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel/>
                        </ItemsPanelTemplate>
                    </delay:DeferredLoadListBox.ItemsPanel>
                </delay:DeferredLoadListBox>-->

                <!--Style="{StaticResource THCStatsKickerListBoxTemplate}"-->

                <my:AdControl x:Name="THCStartingHandsAd"
                              Grid.Row="3"
                              Width="{Binding Width}"
                              Height="{Binding Height}"
                              Margin="0"
                              VerticalAlignment="Center"
                              d:IsHidden="True"
                              DataContext="{Binding Source={StaticResource Locator}, Path=AdProvider}" />

                <Button x:Name="StartingHandsSelectButton"
                        Grid.Row="2"
                        Width="48"
                        Height="48"
                        HorizontalAlignment="Center"
                        d:IsHidden="True"
                        Style="{StaticResource RoundButtonCircleStyle}">
                    <Image x:Name="ImageStartingHandSelect"
                           Grid.Column="0"
                           Source="../Images/Icons/48/appbar.check.rest.png" />
                    <Custom:Interaction.Triggers>
                        <Custom:EventTrigger EventName="Click">
                            <MvvmLite:EventToCommand x:Name="StartingHandChangedCommand" Command="{Binding StartingHandChangedCommand}" />
                        </Custom:EventTrigger>
                    </Custom:Interaction.Triggers>
                </Button>
                
                <Border Grid.RowSpan="4"
                        Style="{StaticResource OutsPopupBorderStyle}"
                        Visibility="{Binding Visibility}" d:IsHidden="True">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="65" />
                            <RowDefinition />
                            <RowDefinition Height="80" />
                        </Grid.RowDefinitions>

                        <TextBlock Grid.Row="1"
                                   VerticalAlignment="Stretch"
                                   FontSize="{StaticResource PhoneFontSizeLarge}"
                                   Foreground="{StaticResource PhoneForegroundBrush}"
                                   LineStackingStrategy="BlockLineHeight"
                                   Text="{Binding SignOnText}"
                                   TextAlignment="Center"
                                   TextWrapping="Wrap" />
                        <Controls1:SignInButton x:Name="SkyDriveSignInButton"
                                                Grid.Row="1"
                                                Width="160"
                                                Height="80"
                                                Branding="Skydrive"
                                                IsEnabled="{Binding IsNetworkAvailable}"
                                                ClientId="{Binding ClientId}"
                                                DataContext="{Binding Source={StaticResource Locator}, Path=SecurityProvider}"
                                                RedirectUri="{Binding RedirectUri}"
                                                Scopes="{Binding Scopes}"
                                                TextType="SignIn">
                        </Controls1:SignInButton>
                        
                        <Button x:Name="HandNotLoadedSelectButton"
                                Grid.Row="2"
                                Width="48"
                                Height="50"
                                HorizontalAlignment="Center"
                                Style="{StaticResource RoundButtonCircleStyle}">
                            <Image x:Name="ImageOutsSelect" Source="../Images/Icons/48/appbar.close.rest.png" />
                            <Custom:Interaction.Triggers>
                                <Custom:EventTrigger EventName="Click">
                                    <MvvmLite:EventToCommand x:Name="StartingHandsVisibilityCommand" Command="{Binding VisibilityCommand}" />
                                </Custom:EventTrigger>
                            </Custom:Interaction.Triggers>
                        </Button>
                    </Grid>
                </Border>
            </Grid>
        </Border>
    </Grid>
</Controls:PhoneApplicationPage>